package com.minelx.statementsplus.conditions;

import com.minelx.sqlstructures.statements.clause.Conditions;
import com.minelx.sqlstructures.statements.clause.Sql;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class ConditionsPlus {
	private static final String PROVINCE = "proxy_id_1";

	private static final String CITY = "proxy_id_2";

	public static Sql city(int province, int city) {
		return Conditions.and(Arrays.asList(Conditions.eq(PROVINCE, String.valueOf(province)), Conditions.eq(CITY, String.valueOf(city))));
	}

	public static Sql proxies(int[] proxyIds) {
		List<Sql> allSql = IntStream.range(0, proxyIds.length)
				.mapToObj(at -> Conditions.eq("proxy_id_" + (at + 1), String.valueOf(proxyIds[at])))
				.collect(Collectors.toList());
		return Conditions.and(allSql);
	}
}
